﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// 文件名：ClsParameterSetDAL.cs
/// 作  者：SAM
/// 时  间：2006.12.27
/// 说  明：ClsParameterSetDAL类用于参数设置相关处理
/// </summary>
public class ClsParameterSetDAL
{
    /// <summary>
    /// 数据库连接字符串
    /// </summary>
    private static string strSqlConnectionString = ConfigurationManager.AppSettings["SQLCONNECTIONSTRING"];

    /// <summary>
    /// 获取信息
    /// </summary>
    public DataSet GetParameterSet()
    {
        DataSet dst = new DataSet();
        SqlConnection con = new SqlConnection(strSqlConnectionString);
        SqlDataAdapter dat = new SqlDataAdapter("Pro_GetParameterSet", con);

        dat.SelectCommand.CommandType = CommandType.StoredProcedure;

        try
        {
            dat.Fill(dst);
        }
        catch
        {
            dst = null;
        }
        finally
        {
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }
        }

        return dst;
    }

 
    /// <summary>
    /// 修改参数设置信息
    /// </summary>
    public Boolean UpdateParameterSet()
    {
        SqlConnection con = new SqlConnection(strSqlConnectionString);
        SqlCommand com = new SqlCommand("Pro_UpDateParameterSet", con);

        com.CommandType = CommandType.StoredProcedure;
        //com.Parameters.Add("@Nt_ID", SqlDbType.NVarChar, 20);
        //com.Parameters["@Nt_ID"].Value = ID;
        //com.Parameters.Add("@Nt_Name", SqlDbType.NVarChar, 20);
        //com.Parameters["@Nt_Name"].Value = Name;
        ////中间插入各表的数据和参数

        //com.Parameters.Add("@Remark", SqlDbType.NVarChar, 255);
        //com.Parameters["@Remark"].Value = Remark;

        try
        {
            con.Open();
            com.ExecuteNonQuery();

            return true;
        }
        catch
        {
            return false;
        }
        finally
        {
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }
        }
    }

}
